$(document).ready(function () {
    let memberData = JSON.parse(sessionStorage.getItem('memberData'));
    console.log("health_record memberData:");
    console.log(memberData);
    //获取个人信息
    $(".name").html(memberData.name)
    $(".sex").html(memberData.gender === 1 ? "男" : "女")
    $(".phone").html(memberData.phone)
    $(".identity").html(memberData.sid)
    let bqList = "";
    for (let index in memberData.bqList) {
        bqList += memberData.bqList[index] + "，"
    }
    $(".tagShow").html(bqList)

    //本次问诊信息
    $(".symptomDuration").html(memberData.symptomDuration == "" ? "-" : memberData.symptomDuration)
    $(".visitRecords").html(memberData.visitRecords === 1 ? "是" : "否")
    $(".diagnosisDisease").html(memberData.diagnosisDisease === 1 ? "是" : "否")
    $(".diagnosis").html(memberData.diagnosis === "" ? "-" : memberData.diagnosis)
    $(".conditionDescription").html(memberData.conditionDescription === "" ? "-" : memberData.conditionDescription)

    //健康档案
    $(".height").html(memberData.height == "" ? "-" : memberData.height + "cm")
    $(".weight").html(memberData.weight == "" ? "-" : memberData.weight + "kg")
    $(".bodyFat").html(memberData.bodyFat == "" ? "-" : memberData.bodyFat + "%")
    $(".bloodSugar").html(memberData.bloodSugar == "" ? "-" : memberData.bloodSugar + "mmol/L")
    $(".bloodPressure").html(memberData.bloodPressure == "" ? "-" : memberData.bloodPressure + "mmHg")
    $(".heartRate").html(memberData.heartRate == "" ? "-" : memberData.heartRate + "bmp")
    $(".historySurgeryTrauma").html(memberData.historySurgeryTrauma == "" ? "-" : memberData.historySurgeryTrauma)
    $(".pastMedicalHistory").html(memberData.pastMedicalHistory == "" ? "-" : memberData.pastMedicalHistory)
    $(".historyDrugAllergy").html(memberData.historyDrugAllergy == "" ? "-" : memberData.historyDrugAllergy)
    if (memberData.pictureIllness == null) {
        $(".pictureIllness").html("-")
    } else {
        $(".pictureIllness").css("color", "#FF5A5A").attr("onclick", "pictureIllnessList()").html("点击查看")
    }
});

function pictureIllnessList() {
    let content = "";
    $(JSON.parse(sessionStorage.getItem('memberData')).pictureIllness).each(function (index, element) {
        content += '<img style="width:100%;height:auto;" src="' + element + '">';
    })
    parent.parent.layer.open({
        type: 1,
        title: "病历资料",
        // maxmin: true,
        area: ["600px", "600px"],
        content: content,
        shadeClose: true,
    });
}